package com.xidata.dict.translate.youdao;

import com.xidata.dict.model.Language;
import lombok.Getter;

/**
 * @author: yukikyu
 * @date: 2022-12-15 16:01
 */
@Getter
public enum YoudaoLanguage {
    ZH_CHS("中文", "zh-CHS"),
    ZH_CHT("中文繁体", "zh-CHT"),
    EN("英文", "en"),
    JA("日文", "ja"),
    VI("越南文", "vi"),
    ID("印尼文", "id"),
    MS("马来语", "ms"),
    TH("泰语", "th"),
    TL("菲律宾语", "tl"),
    AUTO("自动识别", "auto");

    /**
     * 名称
     */
    private final String name;

    /**
     * 值
     */
    private final String value;

    YoudaoLanguage(String name, String value) {
        this.name = name;
        this.value = value;
    }

    @Override
    public String toString() {
        return value;
    }

    public static YoudaoLanguage fromLanguage(Language language) {
        switch (language) {
            case en:
                return EN;
            case cht:
                return ZH_CHT;
            case zh:
                return ZH_CHS;
            case th:
                return TH;
            case fil:
                return TL;
            case may:
                return MS;
            case id:
                return ID;
            case vie:
                return VI;
            default:
                return AUTO;
        }
    }
}
